<div class="custom-field-list container-fluid">

  <div class="row">
    <div class="list-toolbar col-xl-12">
      <div class="title">
        <span *ngIf="module!='issue'">自定义字段</span>
        <span *ngIf="module=='issue'">问题字段</span>
      </div>

      <div class="filter">
        <form [formGroup]="queryForm" class="form-inline">
          <ng-container *ngIf="module!='issue'">
            <label>应用于</label>
            <select [(ngModel)]="queryModel.applyTo"  formControlName="applyTo"
                    class="form-control form-control-sm" name="applyTo">
              <option value="test_case">测试用例</option>
              <!--<option value="test_result">测试结果</option>-->
            </select>
            &nbsp;&nbsp;&nbsp;
          </ng-container>
          <label>关键字</label>
          <input [(ngModel)]="queryModel.keywords" formControlName="keywords"
                 type="search" class="form-control form-control-sm" placeholder="" name="keywords">
        </form>
      </div>

      <div class="buttons">
        <button (click)="create()" type="button" class="btn btn-primary btn-with-icon btn-sm">
          <i class="fa fa-plus-circle"></i>新建
        </button>
      </div>
    </div>
  </div>

  <div class="row">
    <table class="table table-hover">
      <thead class="thead-inverse">
      <tr>
        <th>名称</th>
        <th>编码</th>
        <th>应用于</th>

        <th>控件类型</th>
        <th>数据类型</th>

        <!--<th>文本格式</th>-->
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      <tr *ngFor="let item of models; let i = index;">
        <td>{{ item.label }}</td>
        <td>{{ item.colCode }}</td>

        <td>{{ item.applyTo | fieldApplyTo }}</td>

        <td>{{ inputMap[item.input] }}</td>
        <td>{{ typeMap[item.type] }}</td>

<!--        <td>
          <span *ngIf="item.type == 'text'">
            {{ item.format | fieldFormat }} ({{item.rows}})
          </span>
          <span *ngIf="item.type != 'text'">
            N/A
          </span>
        </td>-->
        <td>
          <span *ngIf="i == 0" class="ionic-icon link placeholder"></span>
          <span (click)="up(item)" *ngIf="i > 0" class="fa fa-arrow-up ionic-icon link"></span>

          <span (click)="down(item)" *ngIf="i < models.length - 1" class="fa fa-arrow-down ionic-icon link"></span>
          <span *ngIf="i == models.length - 1" class="ionic-icon link placeholder"></span>
          &nbsp;
          <span (click)="edit(item)" class="link no-underline">编辑</span>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
</div>

